home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_09 / welstea2 / cwobj.h < prev    next >
C/C++ Source or Header  |  1995-05-12  |  2KB  |  77 lines

  1. // CWOBJ.H  Header file for object list classes
  2.  
  3. #ifndef CWOBJ_H
  4. #define CWOBJ_H
  5.  
  6. #define STRICT
  7. #include <windows.h>
  8.  
  9. typedef void *p_void;
  10.  
  11. #define MAX_PATH 80
  12. typedef char path_str[MAX_PATH + 1];
  13.  
  14. class object_list {
  15.    public:
  16.    p_void *the_list;
  17.    int item_count;
  18.    int max_count;
  19.    object_list (int max_items);
  20.    virtual int add_item (void *item_addr);
  21.    virtual int insert_item (int index,void *item_addr);
  22.    virtual void *at(int index);
  23.    virtual int get_count ();
  24.    virtual void delete_item (int index);
  25.    virtual ~object_list (); };
  26.  
  27. typedef struct {
  28.    object_list *item_collection;
  29.    int selected_item;
  30.    } tlist_box_data;
  31.  
  32. #define MAX_DISPLAY_LEN 80
  33.  
  34. enum tdata_type {STR_DATA,PATH_DATA,COLOR_DATA};
  35.  
  36. class tdata_obj {
  37.    public:
  38.    void * value_addr;
  39.    char * descr_addr;
  40.    int item_no;
  41.    tdata_obj (char * the_descr,void * value_ptr,
  42.      int the_item_no)
  43.      {descr_addr = the_descr;
  44.      value_addr = value_ptr;
  45.      item_no = the_item_no; } };
  46.  
  47. void build_display_str (tdata_type data_type,void
  48.        *descr_addr,void *value_addr,int display_len,
  49.        int maxlen,char *the_string);
  50.  
  51. class ttyped_data_obj: public tdata_obj {
  52.    public:
  53.    char display_str[MAX_DISPLAY_LEN + 1];
  54.    tdata_type data_type;
  55.    unsigned short display_len;
  56.    char * wild_str;
  57.    ttyped_data_obj (char * the_descr,
  58.       void * value_ptr,
  59.       tdata_type the_type,
  60.       unsigned short the_len,
  61.       char * the_wild_str,
  62.       int the_item_no) : tdata_obj (the_descr,
  63.              value_ptr,the_item_no) {
  64.      data_type = the_type;
  65.      display_len = the_len;
  66.      if (display_len > MAX_DISPLAY_LEN)
  67.          display_len = MAX_DISPLAY_LEN;
  68.      wild_str = the_wild_str;
  69.      build_display_str (the_type,the_descr,
  70.       value_ptr,the_len,
  71.       MAX_DISPLAY_LEN,display_str); }
  72.    virtual char *get_display_str
  73.      (int maxlen = MAX_DISPLAY_LEN);
  74.    virtual void get_new_value (HWND parent,
  75.     int max_display_len = MAX_DISPLAY_LEN); };
  76. #endif
  77.